'use strict';
const base = require('../base/serviceBase');
const _ = require('lodash');
const moment = require('moment');
const table = 'Vendor';
module.exports = class extends base {
  async createWork(body) {
    const { ctx } = this;
    const { workList = [], code, tenantCode,isTimerWork=false } = body;
    _.map(workList, async work => {
      work.workCode = code;
      work.tenantCode = tenantCode;
      work.isTimerWork = isTimerWork;
      delete work['createdTs'];
      const result = await ctx.app.dbs.insert('Work', work);
    });
    delete body['createdTs'];
    const result = await ctx.app.dbs.insert('Work', body);
    return { status: 'ok', result };
  }
};
